{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "86f3b059",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.date(2021, 11, 8)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### datetime\n",
    "import datetime\n",
    "datetime.date.today()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f8adc26d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2021, tm_mon=11, tm_mday=8, tm_hour=10, tm_min=9, tm_sec=58, tm_wday=0, tm_yday=312, tm_isdst=0)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### time\n",
    "import time\n",
    "time.gmtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "0d67800c",
   "metadata": {},
   "outputs": [],
   "source": [
    "### help()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "7ac9fda6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[0, 1, 2]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### range\n",
    "for i in range(3):\n",
    "    print(i)\n",
    "list(range(0,3))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e883b6a3",
   "metadata": {},
   "source": [
    "##  if else 循环嵌套\n",
    "if 条件:\n",
    "      if-语句块\n",
    "   \n",
    "   if 条件:\n",
    "      if-语句块\n",
    "   else:\n",
    "      else-语句块\n",
    "   \n",
    "   if 条件：\n",
    "      if-语句块\n",
    "   elif 条件:\n",
    "      elif-语句块\n",
    "   ...\n",
    "   else:\n",
    "      else-语句块\n",
    "   可以进行嵌套。 不要超过3层， 最多5层"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "7a4f21b9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "xiaoming\n",
      "lihua\n",
      "zhichao\n"
     ]
    }
   ],
   "source": [
    "### for 循环\n",
    "names =[\"xiaoming\",\"lihua\",\"zhichao\"]\n",
    "for i in names:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "825556dc",
   "metadata": {},
   "outputs": [],
   "source": [
    "## 用户输入\n",
    "username = input(\"username:\")\n",
    "password = input(\"password:\")\n",
    "\n",
    "print(username,password)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bd920135",
   "metadata": {},
   "outputs": [],
   "source": [
    "### 课本项目\n",
    "today = input(\"weekday:\")\n",
    "if today == \"Saturday\":\n",
    "    print(\"Party!\")\n",
    "elif today == \"Sunday\":\n",
    "    condition = input(\"mood:\")\n",
    "    if condition == \"Headache\":\n",
    "        print(\"Recover, then rest.\")\n",
    "    else:\n",
    "        print(\"Rest.\")\n",
    "else:\n",
    "    print(\"Work, work, work.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1d52fb84",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
